package com.taxshare.operation.controller;

import com.taxshare.mybatis.pager.PageRequest;
import com.taxshare.response.beans.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.taxshare.operation.service.MessageTemplateService;
import com.taxshare.operation.view.vo.MessageTemplateVO;

/**
    * @ClassName: MessageTemplateController
    * @Description: (消息模板)
    * @author liupp
    * @date 2021年1月26日
    *
 */
@RestController
@RequestMapping(value = "/message/template")
@Api(tags = "消息模板")
public class MessageTemplateController{

    @Autowired
    private MessageTemplateService messageTemplateService;

    @RequestMapping(method = RequestMethod.POST, value = "/queryPageList")
    @ApiOperation(notes = "消息模板【分页】", value = "消息模板【分页】")
    public Response<IPage<MessageTemplateVO>> getTemplateList(@RequestBody PageRequest<MessageTemplateVO> query) {
        return messageTemplateService.queryPageList(query);
    }

    @RequestMapping(method = RequestMethod.POST, value = "/add")
    @ApiOperation(notes = "消息模板", value = "新增")
    public Response add(@RequestBody MessageTemplateVO commonCodeInfoDTO) {
        return messageTemplateService.addTemplate(commonCodeInfoDTO);
    }

    @RequestMapping(method = RequestMethod.POST, value = "/edit")
    @ApiOperation(notes = "消息模板", value = "编辑")
    public Response edit(@RequestBody MessageTemplateVO commonCodeInfoDTO) {
        return messageTemplateService.updateTemplate(commonCodeInfoDTO);
    }

    @RequestMapping(method = RequestMethod.POST, value = "/delete")
    @ApiOperation(notes = "消息模板", value = "删除")
    public Response delete(@ApiParam(value = "唯一标识集合", required = true)@RequestBody String uuid) {
        return messageTemplateService.deleteTemplate(uuid);
    }

    
}
